﻿require "System.ShortcutNameSpace"
require "System.CustomLog"
require "Util.event"
require "Util.Timer"
require "Util.BaseClass"

----------订阅Update、Timer 测试 Start----------
local listener = {
	update = function ()
		print("执行update事件, <color=red>隐藏场景里的AppStartup，此函数就不会执行</color>")
	end,
	timer = function ( ... )
		print("执行timer事件, <color=green>隐藏场景里的AppStartup，此函数就不会执行</color>")
	end
}
local handle_update = nil
local handle_timer = nil
----------订阅Update、Timer 测试 End----------


--Unity 回调代码
function Awake()

end

function Start()
    print("start Application.version:", Application.version)
end

function OnEnable()
	--订阅Update
	--handle_update = UpdateBeat:Add(listener.update, listener)

	--订阅Timer
	--handle_timer = Timer.New(listener.timer, 1, -1)--loop=-1，执行无数次
	--handle_timer:Start()
end

function OnDisable()
	--退阅Update
	--UpdateBeat:Remove(handle_update)
	--handle_update = nil

	--退阅Timer
	--handle_timer:Stop()
	--handle_timer = nil
end

function Update()
 	UpdateBeat()
end

function OnDestroy()
  
end

function FixedUpdate()
	FixedUpdateBeat()
end

function TinaXOnStart()
	require "Base.Mono"
	require "Base.MonoObj"
	require "UI.Base.UIKit"
	require "UI.Base.MonoUI"
    require "UI.mainScreen"
    
    require "Game.Base.MonoGameObject"
	require "Game.Controller.GameController"
	require "Game.Controller.Player"

	require "Util.EngineTool"
	UIKit()
end